package com.imelite.qyh.repository;


import com.imelite.qyh.base.ApplicationContextHelper;
import com.imelite.qyh.model.Jxcpcsfz;
import com.imelite.qyh.service.JxcpcsfzService;

import java.util.ArrayList;
import java.util.List;

public class JxcpcsfzRepository {
    private static JxcpcsfzService jxcpcsfzService= (JxcpcsfzService) ApplicationContextHelper.getBean("jxcpcsfzService");

    private static JxcpcsfzRepository instance = null;
    public static synchronized JxcpcsfzRepository getInstance() {
        if (instance == null) {
            instance = new JxcpcsfzRepository();
        }
        return instance;
    }

    public static List<Jxcpcsfz> selectByGroup(String id){
        List<Jxcpcsfz> jxcpcsfzList=jxcpcsfzService.selectAll();
        List<Jxcpcsfz> temp=new ArrayList<>();
        for(Jxcpcsfz j:jxcpcsfzList){
            if(j.getYmfz().equals(id)){
                temp.add(j);
            }
        }
        return temp;
    }
}
